Manages the buffers declared within the component. More...
Public Member Functions | |
~BufferManager () | |
Buffer * | createOrRetrieve (const std::string_view &name) |
Buffer * | get (const std::string_view &name) |
Buffer * | getByIndex (unsigned int index) |
void | rename (const std::string_view &oldName, const std::string_view &newName) |
void | erase (const std::string_view &name) |
Manages the buffers declared within the component.
Buffer creation / deletion needs to go through this class, to be sure created Buffers are the right one for the active Renderer. Like any Manager, it is always owning the memory it returns. External code should never allocate or deallocate buffers without calling this class' methods.
nkGraphics::BufferManager::~BufferManager | ( | ) |
Destructor. In theory, should never be called by external code. If really needed, call the SingletonClass<>::kill() method.
Buffer* nkGraphics::BufferManager::createOrRetrieve | ( | const std::string_view & | name | ) |
Creates if unavailable, or retrieves if available, buffer with given name.
name | The name of the buffer to create or retrieve. |
Buffer* nkGraphics::BufferManager::get | ( | const std::string_view & | name | ) |
Retrieves buffer identified by given name.
name | The name of the buffer to retrieve. |
Buffer* nkGraphics::BufferManager::getByIndex | ( | unsigned int | index | ) |
Retrieves a buffer, by index.
index | The index of the buffer to retrieve. |
void nkGraphics::BufferManager::rename | ( | const std::string_view & | oldName, |
const std::string_view & | newName | ||
) |
Renames a buffer, both changing the way to access it from the manager and the name set on the buffer.
oldName | The name to change from. |
newName | The name to change to. |
void nkGraphics::BufferManager::erase | ( | const std::string_view & | name | ) |
Erases a buffer, freeing its memory.
name | The name of the buffer to erase. |